/*
 * Copyright (c) 2023 Huawei Technologies Co., Ltd.
 * openUBMC is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *         http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 */

#ifndef DEV_NCSI_OVER_MCTP_STANDARD_H
#define DEV_NCSI_OVER_MCTP_STANDARD_H

#include <ncsi_over_mctp/ncsi_over_mctp.h>

namespace dev {

typedef struct ncsi_link_status_info {
    std::string link_status;
    uint32_t    speed_mbps;
    bool        full_duplex;
} ncsi_link_status_info_t;

typedef struct ncsi_version_id_info {
    std::string firmware_version;
    std::string vid;
    std::string did;
    std::string svid;
    std::string sdid;
} ncsi_version_id_info_t;

typedef struct ncsi_port_metrics_info {
    std::string rx_frames;
    std::string tx_frames;
    std::string rx_unicast_frames;
    std::string tx_unicast_frames;
    std::string rx_multicast_frames;
    std::string tx_multicast_frames;
    std::string rx_broadcast_frames;
    std::string tx_broadcast_frames;
    std::string rx_fcs_errors;
    std::string rx_under_size_frames;
    std::string rx_over_size_frames;
    std::string tx_single_collisions;
    std::string tx_multiple_collisions;
    std::string tx_late_collisions;
    std::string tx_excessive_collisions;
    std::string rx_frame_alignment_errors;

} ncsi_port_metrics_info_t;

class MC_API ncsi_over_mctp_standard : public ncsi_over_mctp {
public:
    ncsi_over_mctp_standard(mctp& mctp_obj) : ncsi_over_mctp(mctp_obj) {};
    ~ncsi_over_mctp_standard() {};
    bool get_link_status(uint8_t package_id, uint8_t channel_id,
                         ncsi_link_status_info_t* link_status);
    bool init_ncsi_channel(uint8_t package_id, uint8_t channel_id);
    bool get_version_id(uint8_t package_id, uint8_t channel_id,
                        ncsi_version_id_info_t* version_info);
    bool get_port_metrics(uint8_t package_id, uint8_t channel_id,
                          ncsi_port_metrics_info_t* port_metrics_info);
    bool send_test_packet(uint8_t package_id, uint8_t channel_id, uint8_t cmd_code,
                          const std::string& req_data);
};
} // namespace dev

#endif // DEV_NCSI_OVER_MCTP_STANDARD_H
